// Copyright (c) 2010, SMB SAAS Systems Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must  retain  the  above copyright notice, this
//   list of conditions and the following disclaimer.
//
// - Redistributions in binary form  must  reproduce the  above  copyright  notice,
//   this list of conditions  and  the  following  disclaimer in  the documentation
//   and/or other materials provided with the distribution.
//
// - Neither  the  name  of  the  SMB SAAS Systems Inc.  nor   the   names  of  its
//   contributors may be used to endorse or  promote  products  derived  from  this
//   software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,  BUT  NOT  LIMITED TO, THE IMPLIED
// WARRANTIES  OF  MERCHANTABILITY   AND  FITNESS  FOR  A  PARTICULAR  PURPOSE  ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL,  SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO,  PROCUREMENT  OF  SUBSTITUTE  GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)  HOWEVER  CAUSED AND ON
// ANY  THEORY  OF  LIABILITY,  WHETHER  IN  CONTRACT,  STRICT  LIABILITY,  OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE)  ARISING  IN  ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.1433
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

// 
// This source code was auto-generated by wsdl, Version=2.0.50727.42.
// 
using dotPanel.Providers;
using dotPanel.Providers.Common;
using dotPanel.Providers.HostedSolution;
using dotPanel.Providers.ResultObjects;

namespace dotPanel.EnterpriseServer {
    using System.Diagnostics;
    using System.Web.Services;
    using System.ComponentModel;
    using System.Web.Services.Protocols;
    using System;
    using System.Xml.Serialization;
    
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Web.Services.WebServiceBindingAttribute(Name="esCRMSoap", Namespace="http://smbsaas/dotpanel/enterpriseserver")]
    [System.Xml.Serialization.XmlIncludeAttribute(typeof(ServiceProviderItem))]
    public partial class esCRM : Microsoft.Web.Services3.WebServicesClientProtocol {
        
        private System.Threading.SendOrPostCallback CreateOrganizationOperationCompleted;
        
        private System.Threading.SendOrPostCallback GetCollationOperationCompleted;
        
        private System.Threading.SendOrPostCallback GetCurrencyOperationCompleted;
        
        private System.Threading.SendOrPostCallback DeleteCRMOrganizationOperationCompleted;
        
        private System.Threading.SendOrPostCallback GetCRMUsersPagedOperationCompleted;
        
        private System.Threading.SendOrPostCallback GetCRMUserCountOperationCompleted;
        
        private System.Threading.SendOrPostCallback CreateCRMUserOperationCompleted;
        
        private System.Threading.SendOrPostCallback GetBusinessUnitsOperationCompleted;
        
        private System.Threading.SendOrPostCallback GetCrmRolesOperationCompleted;
        
        private System.Threading.SendOrPostCallback SetUserRolesOperationCompleted;
        
        private System.Threading.SendOrPostCallback ChangeUserStateOperationCompleted;
        
        private System.Threading.SendOrPostCallback GetCrmUserOperationCompleted;
        
        /// <remarks/>
        public esCRM() {
            this.Url = "http://localhost/dotPanelEnterpriseServer/esCRM.asmx";
        }
        
        /// <remarks/>
        public event CreateOrganizationCompletedEventHandler CreateOrganizationCompleted;
        
        /// <remarks/>
        public event GetCollationCompletedEventHandler GetCollationCompleted;
        
        /// <remarks/>
        public event GetCurrencyCompletedEventHandler GetCurrencyCompleted;
        
        /// <remarks/>
        public event DeleteCRMOrganizationCompletedEventHandler DeleteCRMOrganizationCompleted;
        
        /// <remarks/>
        public event GetCRMUsersPagedCompletedEventHandler GetCRMUsersPagedCompleted;
        
        /// <remarks/>
        public event GetCRMUserCountCompletedEventHandler GetCRMUserCountCompleted;
        
        /// <remarks/>
        public event CreateCRMUserCompletedEventHandler CreateCRMUserCompleted;
        
        /// <remarks/>
        public event GetBusinessUnitsCompletedEventHandler GetBusinessUnitsCompleted;
        
        /// <remarks/>
        public event GetCrmRolesCompletedEventHandler GetCrmRolesCompleted;
        
        /// <remarks/>
        public event SetUserRolesCompletedEventHandler SetUserRolesCompleted;
        
        /// <remarks/>
        public event ChangeUserStateCompletedEventHandler ChangeUserStateCompleted;
        
        /// <remarks/>
        public event GetCrmUserCompletedEventHandler GetCrmUserCompleted;
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/CreateOrganization", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public OrganizationResult CreateOrganization(int organizationId, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string regionName, int userId, string collation) {
            object[] results = this.Invoke("CreateOrganization", new object[] {
                        organizationId,
                        baseCurrencyCode,
                        baseCurrencyName,
                        baseCurrencySymbol,
                        regionName,
                        userId,
                        collation});
            return ((OrganizationResult)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginCreateOrganization(int organizationId, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string regionName, int userId, string collation, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("CreateOrganization", new object[] {
                        organizationId,
                        baseCurrencyCode,
                        baseCurrencyName,
                        baseCurrencySymbol,
                        regionName,
                        userId,
                        collation}, callback, asyncState);
        }
        
        /// <remarks/>
        public OrganizationResult EndCreateOrganization(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((OrganizationResult)(results[0]));
        }
        
        /// <remarks/>
        public void CreateOrganizationAsync(int organizationId, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string regionName, int userId, string collation) {
            this.CreateOrganizationAsync(organizationId, baseCurrencyCode, baseCurrencyName, baseCurrencySymbol, regionName, userId, collation, null);
        }
        
        /// <remarks/>
        public void CreateOrganizationAsync(int organizationId, string baseCurrencyCode, string baseCurrencyName, string baseCurrencySymbol, string regionName, int userId, string collation, object userState) {
            if ((this.CreateOrganizationOperationCompleted == null)) {
                this.CreateOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateOrganizationOperationCompleted);
            }
            this.InvokeAsync("CreateOrganization", new object[] {
                        organizationId,
                        baseCurrencyCode,
                        baseCurrencyName,
                        baseCurrencySymbol,
                        regionName,
                        userId,
                        collation}, this.CreateOrganizationOperationCompleted, userState);
        }
        
        private void OnCreateOrganizationOperationCompleted(object arg) {
            if ((this.CreateOrganizationCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.CreateOrganizationCompleted(this, new CreateOrganizationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/GetCollation", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public StringArrayResultObject GetCollation(int packageId) {
            object[] results = this.Invoke("GetCollation", new object[] {
                        packageId});
            return ((StringArrayResultObject)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetCollation(int packageId, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetCollation", new object[] {
                        packageId}, callback, asyncState);
        }
        
        /// <remarks/>
        public StringArrayResultObject EndGetCollation(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((StringArrayResultObject)(results[0]));
        }
        
        /// <remarks/>
        public void GetCollationAsync(int packageId) {
            this.GetCollationAsync(packageId, null);
        }
        
        /// <remarks/>
        public void GetCollationAsync(int packageId, object userState) {
            if ((this.GetCollationOperationCompleted == null)) {
                this.GetCollationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCollationOperationCompleted);
            }
            this.InvokeAsync("GetCollation", new object[] {
                        packageId}, this.GetCollationOperationCompleted, userState);
        }
        
        private void OnGetCollationOperationCompleted(object arg) {
            if ((this.GetCollationCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetCollationCompleted(this, new GetCollationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/GetCurrency", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public CurrencyArrayResultObject GetCurrency(int packageId) {
            object[] results = this.Invoke("GetCurrency", new object[] {
                        packageId});
            return ((CurrencyArrayResultObject)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetCurrency(int packageId, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetCurrency", new object[] {
                        packageId}, callback, asyncState);
        }
        
        /// <remarks/>
        public CurrencyArrayResultObject EndGetCurrency(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((CurrencyArrayResultObject)(results[0]));
        }
        
        /// <remarks/>
        public void GetCurrencyAsync(int packageId) {
            this.GetCurrencyAsync(packageId, null);
        }
        
        /// <remarks/>
        public void GetCurrencyAsync(int packageId, object userState) {
            if ((this.GetCurrencyOperationCompleted == null)) {
                this.GetCurrencyOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCurrencyOperationCompleted);
            }
            this.InvokeAsync("GetCurrency", new object[] {
                        packageId}, this.GetCurrencyOperationCompleted, userState);
        }
        
        private void OnGetCurrencyOperationCompleted(object arg) {
            if ((this.GetCurrencyCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetCurrencyCompleted(this, new GetCurrencyCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/DeleteCRMOrganization", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public ResultObject DeleteCRMOrganization(int organizationId) {
            object[] results = this.Invoke("DeleteCRMOrganization", new object[] {
                        organizationId});
            return ((ResultObject)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginDeleteCRMOrganization(int organizationId, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("DeleteCRMOrganization", new object[] {
                        organizationId}, callback, asyncState);
        }
        
        /// <remarks/>
        public ResultObject EndDeleteCRMOrganization(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((ResultObject)(results[0]));
        }
        
        /// <remarks/>
        public void DeleteCRMOrganizationAsync(int organizationId) {
            this.DeleteCRMOrganizationAsync(organizationId, null);
        }
        
        /// <remarks/>
        public void DeleteCRMOrganizationAsync(int organizationId, object userState) {
            if ((this.DeleteCRMOrganizationOperationCompleted == null)) {
                this.DeleteCRMOrganizationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnDeleteCRMOrganizationOperationCompleted);
            }
            this.InvokeAsync("DeleteCRMOrganization", new object[] {
                        organizationId}, this.DeleteCRMOrganizationOperationCompleted, userState);
        }
        
        private void OnDeleteCRMOrganizationOperationCompleted(object arg) {
            if ((this.DeleteCRMOrganizationCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.DeleteCRMOrganizationCompleted(this, new DeleteCRMOrganizationCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/GetCRMUsersPaged", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public OrganizationUsersPagedResult GetCRMUsersPaged(int itemId, string sortColumn, string sortDirection, string name, string email, int startRow, int maximumRows) {
            object[] results = this.Invoke("GetCRMUsersPaged", new object[] {
                        itemId,
                        sortColumn,
                        sortDirection,
                        name,
                        email,
                        startRow,
                        maximumRows});
            return ((OrganizationUsersPagedResult)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetCRMUsersPaged(int itemId, string sortColumn, string sortDirection, string name, string email, int startRow, int maximumRows, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetCRMUsersPaged", new object[] {
                        itemId,
                        sortColumn,
                        sortDirection,
                        name,
                        email,
                        startRow,
                        maximumRows}, callback, asyncState);
        }
        
        /// <remarks/>
        public OrganizationUsersPagedResult EndGetCRMUsersPaged(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((OrganizationUsersPagedResult)(results[0]));
        }
        
        /// <remarks/>
        public void GetCRMUsersPagedAsync(int itemId, string sortColumn, string sortDirection, string name, string email, int startRow, int maximumRows) {
            this.GetCRMUsersPagedAsync(itemId, sortColumn, sortDirection, name, email, startRow, maximumRows, null);
        }
        
        /// <remarks/>
        public void GetCRMUsersPagedAsync(int itemId, string sortColumn, string sortDirection, string name, string email, int startRow, int maximumRows, object userState) {
            if ((this.GetCRMUsersPagedOperationCompleted == null)) {
                this.GetCRMUsersPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCRMUsersPagedOperationCompleted);
            }
            this.InvokeAsync("GetCRMUsersPaged", new object[] {
                        itemId,
                        sortColumn,
                        sortDirection,
                        name,
                        email,
                        startRow,
                        maximumRows}, this.GetCRMUsersPagedOperationCompleted, userState);
        }
        
        private void OnGetCRMUsersPagedOperationCompleted(object arg) {
            if ((this.GetCRMUsersPagedCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetCRMUsersPagedCompleted(this, new GetCRMUsersPagedCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/GetCRMUserCount", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public IntResult GetCRMUserCount(int itemId, string name, string email) {
            object[] results = this.Invoke("GetCRMUserCount", new object[] {
                        itemId,
                        name,
                        email});
            return ((IntResult)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetCRMUserCount(int itemId, string name, string email, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetCRMUserCount", new object[] {
                        itemId,
                        name,
                        email}, callback, asyncState);
        }
        
        /// <remarks/>
        public IntResult EndGetCRMUserCount(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((IntResult)(results[0]));
        }
        
        /// <remarks/>
        public void GetCRMUserCountAsync(int itemId, string name, string email) {
            this.GetCRMUserCountAsync(itemId, name, email, null);
        }
        
        /// <remarks/>
        public void GetCRMUserCountAsync(int itemId, string name, string email, object userState) {
            if ((this.GetCRMUserCountOperationCompleted == null)) {
                this.GetCRMUserCountOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCRMUserCountOperationCompleted);
            }
            this.InvokeAsync("GetCRMUserCount", new object[] {
                        itemId,
                        name,
                        email}, this.GetCRMUserCountOperationCompleted, userState);
        }
        
        private void OnGetCRMUserCountOperationCompleted(object arg) {
            if ((this.GetCRMUserCountCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetCRMUserCountCompleted(this, new GetCRMUserCountCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/CreateCRMUser", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public UserResult CreateCRMUser(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId) {
            object[] results = this.Invoke("CreateCRMUser", new object[] {
                        user,
                        packageId,
                        itemId,
                        businessUnitOrgId});
            return ((UserResult)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginCreateCRMUser(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("CreateCRMUser", new object[] {
                        user,
                        packageId,
                        itemId,
                        businessUnitOrgId}, callback, asyncState);
        }
        
        /// <remarks/>
        public UserResult EndCreateCRMUser(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((UserResult)(results[0]));
        }
        
        /// <remarks/>
        public void CreateCRMUserAsync(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId) {
            this.CreateCRMUserAsync(user, packageId, itemId, businessUnitOrgId, null);
        }
        
        /// <remarks/>
        public void CreateCRMUserAsync(OrganizationUser user, int packageId, int itemId, System.Guid businessUnitOrgId, object userState) {
            if ((this.CreateCRMUserOperationCompleted == null)) {
                this.CreateCRMUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateCRMUserOperationCompleted);
            }
            this.InvokeAsync("CreateCRMUser", new object[] {
                        user,
                        packageId,
                        itemId,
                        businessUnitOrgId}, this.CreateCRMUserOperationCompleted, userState);
        }
        
        private void OnCreateCRMUserOperationCompleted(object arg) {
            if ((this.CreateCRMUserCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.CreateCRMUserCompleted(this, new CreateCRMUserCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/GetBusinessUnits", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public CRMBusinessUnitsResult GetBusinessUnits(int itemId, int packageId) {
            object[] results = this.Invoke("GetBusinessUnits", new object[] {
                        itemId,
                        packageId});
            return ((CRMBusinessUnitsResult)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetBusinessUnits(int itemId, int packageId, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetBusinessUnits", new object[] {
                        itemId,
                        packageId}, callback, asyncState);
        }
        
        /// <remarks/>
        public CRMBusinessUnitsResult EndGetBusinessUnits(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((CRMBusinessUnitsResult)(results[0]));
        }
        
        /// <remarks/>
        public void GetBusinessUnitsAsync(int itemId, int packageId) {
            this.GetBusinessUnitsAsync(itemId, packageId, null);
        }
        
        /// <remarks/>
        public void GetBusinessUnitsAsync(int itemId, int packageId, object userState) {
            if ((this.GetBusinessUnitsOperationCompleted == null)) {
                this.GetBusinessUnitsOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetBusinessUnitsOperationCompleted);
            }
            this.InvokeAsync("GetBusinessUnits", new object[] {
                        itemId,
                        packageId}, this.GetBusinessUnitsOperationCompleted, userState);
        }
        
        private void OnGetBusinessUnitsOperationCompleted(object arg) {
            if ((this.GetBusinessUnitsCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetBusinessUnitsCompleted(this, new GetBusinessUnitsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/GetCrmRoles", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public CrmRolesResult GetCrmRoles(int itemId, int accountId, int packageId) {
            object[] results = this.Invoke("GetCrmRoles", new object[] {
                        itemId,
                        accountId,
                        packageId});
            return ((CrmRolesResult)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetCrmRoles(int itemId, int accountId, int packageId, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetCrmRoles", new object[] {
                        itemId,
                        accountId,
                        packageId}, callback, asyncState);
        }
        
        /// <remarks/>
        public CrmRolesResult EndGetCrmRoles(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((CrmRolesResult)(results[0]));
        }
        
        /// <remarks/>
        public void GetCrmRolesAsync(int itemId, int accountId, int packageId) {
            this.GetCrmRolesAsync(itemId, accountId, packageId, null);
        }
        
        /// <remarks/>
        public void GetCrmRolesAsync(int itemId, int accountId, int packageId, object userState) {
            if ((this.GetCrmRolesOperationCompleted == null)) {
                this.GetCrmRolesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCrmRolesOperationCompleted);
            }
            this.InvokeAsync("GetCrmRoles", new object[] {
                        itemId,
                        accountId,
                        packageId}, this.GetCrmRolesOperationCompleted, userState);
        }
        
        private void OnGetCrmRolesOperationCompleted(object arg) {
            if ((this.GetCrmRolesCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetCrmRolesCompleted(this, new GetCrmRolesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/SetUserRoles", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public ResultObject SetUserRoles(int itemId, int accountId, int packageId, System.Guid[] roles) {
            object[] results = this.Invoke("SetUserRoles", new object[] {
                        itemId,
                        accountId,
                        packageId,
                        roles});
            return ((ResultObject)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginSetUserRoles(int itemId, int accountId, int packageId, System.Guid[] roles, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("SetUserRoles", new object[] {
                        itemId,
                        accountId,
                        packageId,
                        roles}, callback, asyncState);
        }
        
        /// <remarks/>
        public ResultObject EndSetUserRoles(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((ResultObject)(results[0]));
        }
        
        /// <remarks/>
        public void SetUserRolesAsync(int itemId, int accountId, int packageId, System.Guid[] roles) {
            this.SetUserRolesAsync(itemId, accountId, packageId, roles, null);
        }
        
        /// <remarks/>
        public void SetUserRolesAsync(int itemId, int accountId, int packageId, System.Guid[] roles, object userState) {
            if ((this.SetUserRolesOperationCompleted == null)) {
                this.SetUserRolesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetUserRolesOperationCompleted);
            }
            this.InvokeAsync("SetUserRoles", new object[] {
                        itemId,
                        accountId,
                        packageId,
                        roles}, this.SetUserRolesOperationCompleted, userState);
        }
        
        private void OnSetUserRolesOperationCompleted(object arg) {
            if ((this.SetUserRolesCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.SetUserRolesCompleted(this, new SetUserRolesCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/ChangeUserState", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public ResultObject ChangeUserState(int itemId, int accountId, bool disable) {
            object[] results = this.Invoke("ChangeUserState", new object[] {
                        itemId,
                        accountId,
                        disable});
            return ((ResultObject)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginChangeUserState(int itemId, int accountId, bool disable, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("ChangeUserState", new object[] {
                        itemId,
                        accountId,
                        disable}, callback, asyncState);
        }
        
        /// <remarks/>
        public ResultObject EndChangeUserState(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((ResultObject)(results[0]));
        }
        
        /// <remarks/>
        public void ChangeUserStateAsync(int itemId, int accountId, bool disable) {
            this.ChangeUserStateAsync(itemId, accountId, disable, null);
        }
        
        /// <remarks/>
        public void ChangeUserStateAsync(int itemId, int accountId, bool disable, object userState) {
            if ((this.ChangeUserStateOperationCompleted == null)) {
                this.ChangeUserStateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnChangeUserStateOperationCompleted);
            }
            this.InvokeAsync("ChangeUserState", new object[] {
                        itemId,
                        accountId,
                        disable}, this.ChangeUserStateOperationCompleted, userState);
        }
        
        private void OnChangeUserStateOperationCompleted(object arg) {
            if ((this.ChangeUserStateCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.ChangeUserStateCompleted(this, new ChangeUserStateCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/dotpanel/enterpriseserver/GetCrmUser", RequestNamespace="http://smbsaas/dotpanel/enterpriseserver", ResponseNamespace="http://smbsaas/dotpanel/enterpriseserver", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        public CrmUserResult GetCrmUser(int itemId, int accountId) {
            object[] results = this.Invoke("GetCrmUser", new object[] {
                        itemId,
                        accountId});
            return ((CrmUserResult)(results[0]));
        }
        
        /// <remarks/>
        public System.IAsyncResult BeginGetCrmUser(int itemId, int accountId, System.AsyncCallback callback, object asyncState) {
            return this.BeginInvoke("GetCrmUser", new object[] {
                        itemId,
                        accountId}, callback, asyncState);
        }
        
        /// <remarks/>
        public CrmUserResult EndGetCrmUser(System.IAsyncResult asyncResult) {
            object[] results = this.EndInvoke(asyncResult);
            return ((CrmUserResult)(results[0]));
        }
        
        /// <remarks/>
        public void GetCrmUserAsync(int itemId, int accountId) {
            this.GetCrmUserAsync(itemId, accountId, null);
        }
        
        /// <remarks/>
        public void GetCrmUserAsync(int itemId, int accountId, object userState) {
            if ((this.GetCrmUserOperationCompleted == null)) {
                this.GetCrmUserOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetCrmUserOperationCompleted);
            }
            this.InvokeAsync("GetCrmUser", new object[] {
                        itemId,
                        accountId}, this.GetCrmUserOperationCompleted, userState);
        }
        
        private void OnGetCrmUserOperationCompleted(object arg) {
            if ((this.GetCrmUserCompleted != null)) {
                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
                this.GetCrmUserCompleted(this, new GetCrmUserCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
            }
        }
        
        /// <remarks/>
        public new void CancelAsync(object userState) {
            base.CancelAsync(userState);
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void CreateOrganizationCompletedEventHandler(object sender, CreateOrganizationCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class CreateOrganizationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal CreateOrganizationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public OrganizationResult Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((OrganizationResult)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void GetCollationCompletedEventHandler(object sender, GetCollationCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetCollationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetCollationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public StringArrayResultObject Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((StringArrayResultObject)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void GetCurrencyCompletedEventHandler(object sender, GetCurrencyCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetCurrencyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetCurrencyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public CurrencyArrayResultObject Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((CurrencyArrayResultObject)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void DeleteCRMOrganizationCompletedEventHandler(object sender, DeleteCRMOrganizationCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class DeleteCRMOrganizationCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal DeleteCRMOrganizationCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public ResultObject Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((ResultObject)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void GetCRMUsersPagedCompletedEventHandler(object sender, GetCRMUsersPagedCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetCRMUsersPagedCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetCRMUsersPagedCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public OrganizationUsersPagedResult Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((OrganizationUsersPagedResult)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void GetCRMUserCountCompletedEventHandler(object sender, GetCRMUserCountCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetCRMUserCountCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetCRMUserCountCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public IntResult Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((IntResult)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void CreateCRMUserCompletedEventHandler(object sender, CreateCRMUserCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class CreateCRMUserCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal CreateCRMUserCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public UserResult Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((UserResult)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void GetBusinessUnitsCompletedEventHandler(object sender, GetBusinessUnitsCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetBusinessUnitsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetBusinessUnitsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public CRMBusinessUnitsResult Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((CRMBusinessUnitsResult)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void GetCrmRolesCompletedEventHandler(object sender, GetCrmRolesCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetCrmRolesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetCrmRolesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public CrmRolesResult Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((CrmRolesResult)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void SetUserRolesCompletedEventHandler(object sender, SetUserRolesCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class SetUserRolesCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal SetUserRolesCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public ResultObject Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((ResultObject)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void ChangeUserStateCompletedEventHandler(object sender, ChangeUserStateCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class ChangeUserStateCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal ChangeUserStateCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public ResultObject Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((ResultObject)(this.results[0]));
            }
        }
    }
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    public delegate void GetCrmUserCompletedEventHandler(object sender, GetCrmUserCompletedEventArgs e);
    
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]
    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    public partial class GetCrmUserCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
        
        private object[] results;
        
        internal GetCrmUserCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
                base(exception, cancelled, userState) {
            this.results = results;
        }
        
        /// <remarks/>
        public CrmUserResult Result {
            get {
                this.RaiseExceptionIfNecessary();
                return ((CrmUserResult)(this.results[0]));
            }
        }
    }
}
